<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="description" content="{{env('SITE_DESCRIPTION')}}">
    <meta name="csrf-token" content="{{csrf_token()}}">
    <title>{{env('SITE_TITLE')}}</title>

    <link href="{{asset('/org/site')}}/AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css"/>
    <link href="{{asset('/org/site')}}/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css"/>
    <link href="{{asset('/org/site')}}/basic/css/demo.css" rel="stylesheet" type="text/css"/>
    <link type="text/css" href="{{asset('/org/site')}}/css/optstyle.css" rel="stylesheet"/>
    <link type="text/css" href="{{asset('/org/site')}}/css/style.css" rel="stylesheet"/>
    <link rel="stylesheet" href="{{asset('/org/plus')}}/animate.css">
    <link rel="stylesheet" href="{{asset('/org/plus/city-picker.css')}}">
    {{--<link rel="stylesheet" href="{{asset('/org/plus')}}/sweetalert2.css">--}}
    <script type="text/javascript" src="{{asset('/org/site')}}/basic/js/jquery-1.7.min.js"></script>
    <script type="text/javascript" src="{{asset('/org/site')}}/basic/js/quick_links.js"></script>

    <script type="text/javascript" src="{{asset('/org/site')}}/AmazeUI-2.4.2/assets/js/amazeui.js"></script>
    <script type="text/javascript" src="{{asset('/org/site')}}/js/jquery.imagezoom.min.js"></script>
    <script type="text/javascript" src="{{asset('/org/site')}}/js/jquery.flexslider.js"></script>
    <script type="text/javascript" src="{{asset('/org/site')}}/js/list.js"></script>
    <script type="text/javascript" src="{{asset('/org/plus')}}/sweetalert2.all.min.js"></script>
    {{--引入城市插件--}}
    <script type="text/javascript" src="{{asset('/org/plus/city-picker.data.js')}}"></script>
    <script type="text/javascript" src="{{asset('/org/plus/city-picker.js')}}"></script>
    {{--@include('admin.layouts._hdjs')--}}

</head>

<body>

{{--公共的头部导航和搜索框--}}
@include('site.layouts._top')

<div class="clear"></div>
<b class="line"></b>
<div class="listMain" style="padding-top: 0">

    <!--分类-->
    <div class="nav-table" style="display: none">
        <div class="long-title"><span class="all-goods">全部分类</span></div>
        <div class="nav-cont">
            <ul>
                <li class="index"><a href="#">首页</a></li>
                <li class="qc"><a href="#">闪购</a></li>
                <li class="qc"><a href="#">限时抢</a></li>
                <li class="qc"><a href="#">团购</a></li>
                <li class="qc last"><a href="#">大包装</a></li>
            </ul>
            <div class="nav-extra">
                <i class="am-icon-user-secret am-icon-md nav-user"></i><b></b>我的福利
                <i class="am-icon-angle-right" style="padding-left: 10px;"></i>
            </div>
        </div>
    </div>
    <ol class="am-breadcrumb am-breadcrumb-slash">
        <li><a href="{{route('site.index')}}">首页:</a></li>
        @foreach($goodsInfo['category_id'] as $category)
            <li class="am-active"><a href="{{route('site.lists',$category)}}">{{$category['title']}}</a></li>
        @endforeach
        <li>内容</li>
    </ol>
    <script type="text/javascript">
        $(function () {
        });
        $(window).load(function () {
            $('.flexslider').flexslider({
                animation: "slide",
                start: function (slider) {
                    $('body').removeClass('loading');
                }
            });
        });
    </script>
    <!--放大镜-->

    <div class="item-inform">
        <div class="clearfixLeft" id="clearcontent">
            <div class="box">
                <script type="text/javascript">
                    $(document).ready(function () {
                        $(".jqzoom").imagezoom();
                        $("#thumblist li a").click(function () {
                            $(this).parents("li").addClass("tb-selected").siblings().removeClass("tb-selected");
                            $(".jqzoom").attr('src', $(this).find("img").attr("mid"));
                            $(".jqzoom").attr('rel', $(this).find("img").attr("big"));
                        });
                    });
                </script>
                {{--放大镜展示区域--}}
                <div class="tb-booth tb-pic tb-s310">
                    <a href="javascript:;">
                        <img src="{{$goodsInfo['pics'][0]}}" alt="细节展示放大镜特效"
                             rel="{{$goodsInfo['pics'][0]}}" class="jqzoom"/>
                    </a>
                </div>
                {{--下面是缩率图--}}
                <ul class="tb-thumb" id="thumblist">
                    @foreach($goodsInfo['pics'] as $img)
                        <li class="tb-selected">
                            <div class="tb-pic tb-s40">
                                <a href="#">
                                    <img src="{{$img}}"
                                         mid="{{$img}}"
                                         big="{{$img}}"
                                    />
                                </a>
                            </div>
                        </li>
                    @endforeach
                </ul>
            </div>

            <div class="clear"></div>
        </div>

        <div class="clearfixRight">

            <!--规格属性-->
            <!--名称-->
            <div class="tb-detail-hd">
                <h1>
                    {{$goodsInfo['title']}}
                </h1>
            </div>
            <div class="tb-detail-list">
                <!--价格-->
                <div class="tb-detail-price">
                    <li class="price iteminfo_price">
                        <dt>促销价</dt>
                        <dd><em>¥</em><b class="sys_item_price">{{$goodsInfo['price']}}</b></dd>
                    </li>
                    <div class="clear"></div>
                </div>

                <!--地址-->
                <dl class="iteminfo_parameter freight">
                    <dt>配送至</dt>
                    <div style="position: relative;top: 5px">
                        <input name="sendAreaInfo" readonly type="text" data-toggle="city-picker">
                    </div>
                </dl>
                <div class="clear"></div>

                <!--销量-->
                <ul class="tm-ind-panel" style="height: 38px;border-width: 0 0 1px">
                    <li class="tm-ind-item tm-ind-sellCount canClick" style="display: none">
                        <div class="tm-indcon"><span class="tm-label">月销量</span><span class="tm-count">1015</span></div>
                    </li>
                    <li class="tm-ind-item tm-ind-sumCount canClick" style="display: none">
                        <div class="tm-indcon"><span class="tm-label">累计销量</span><span class="tm-count">6015</span>
                        </div>
                    </li>
                    <li class="tm-ind-item tm-ind-reviewCount canClick tm-line3" style="display: none">
                        <div class="tm-indcon"><span class="tm-label">累计评价</span><span class="tm-count">640</span></div>
                    </li>
                </ul>
                <div class="clear"></div>

                <!--各种规格-->
                <dl class="iteminfo_parameter sys_item_specpara">
                    <dt class="theme-login">
                        <div class="cart-title">可选规格<span class="am-icon-angle-right"></span></div>
                    </dt>
                    <dd>
                        <!--操作页面-->

                        <div class="theme-popover-mask"></div>

                        <div class="theme-popover">
                            <div class="theme-span"></div>
                            <div class="theme-poptit">
                                <a href="javascript:;" title="关闭" class="close">×</a>
                            </div>
                            <div class="theme-popbod dform">
                                <form class="theme-signin" name="loginform" action="" method="post">

                                    <div class="theme-signin-left">
                                        <div class="theme-options">
                                            <div class="cart-title">属性信息:</div>

                                            {{--dd($goodsInfo)--}}
                                            <ul id="productInfo">
                                                {{--由于我在$goodsInfo['products']中放的是当前商品通过关联模型拿到的对应的货品数据,如果当前商品在产品表中没有对应数据返回一个空数组,但是通过模型关联获取到的是一个collection()对象,一直为真--}}
                                                @if($goodsInfo['products']->toArray())
                                                    @foreach($goodsInfo['products'] as $item)
                                                        <a href="{{route('site.detail',[$goodsInfo['id'],$item['id']])}}">
                                                            <li product_id="{{$item['id']}}"
                                                                class="sku-line {{$item['id']==$product['id']?'selected':''}}">
                                                                {{$item['attrs']?:'标准规格'}}
                                                                <i></i>
                                                            </li>
                                                        </a>
                                                    @endforeach
                                                @else
                                                    <li class="sku-line selected">
                                                        统一规格
                                                        <i></i>
                                                    </li>
                                                @endif
                                            </ul>
                                        </div>
                                        <div class="theme-options">
                                            <div class="cart-title number">数量</div>
                    <dd>
                        <input id="min_me" class="am-btn am-btn-default" onclick="jian()" name="" type="button"
                               value="-"/>
                        {{--inpute输入框标签中的value值是最开始的默认值--}}
                        <input id="text_box_me" onchange="bian(this)" type="text" value="1" style="width:30px;"/>
                        <input id="add_me" onclick="jia()" class="am-btn am-btn-default" name="" type="button"
                               value="+"/>
                        <span id="Stock" class="tb-hidden">货品库存</span>
                        {{--下面显示货品库存的时候判断如果$product['kucun']为假的时候就返回0--}}
                        {{--因为当一个货品没有对应货品的时候$product就是null--}}
                        <span class="stock">{{$product['kucun']?:0}}</span>
                        <span>件</span>
                    </dd>
                    <script>
                        function jian() {
                            var num = $('#text_box_me').val();
                            // 判断当前数量是否大于1,如果不大于一点击"-"数量就一直为1,不能再减了
                            num > 1 ? $('#text_box_me').val(--num) : $('#text_box_me').val(1);
                        }

                        function jia() {
                            // 先获取当前数量
                            var num = $('#text_box_me').val();
                            num < {{$product['kucun']}} ? $('#text_box_me').val(++num) : $('#text_box_me').val({{$product['kucun']}})
                        }

                        //当用户输入的购买数量大于当前库存的时候设置购买数量为当前库存数量,否则就为用户输入的数量
                        function bian(obj) {
                            let num = $(obj).val() * 1;
                            if (num < 0) {
                                // 如果填的数量小于0,设置obj输入框的val值为1
                                $(obj).val(1);
                            } else {
                                //如果用户在输入框中输入的购买数量大于当前库存的话强制将数量改成库存数量,如果不大于库存数量的话什么也不做,就按照用户输入的数量
                                num > {{$product['kucun']}} ? $(obj).val({{$product['kucun']}}) : ''
                            }
                        }
                    </script>
            </div>
            <div class="clear"></div>

            <div class="btn-op">
                <div class="btn am-btn am-btn-warning">确认</div>
                <div class="btn close am-btn am-btn-warning">取消</div>
            </div>
        </div>
        <div class="theme-signin-right">
            <div class="img-info">
                <img src="{{asset('/org/site')}}/images/songzi.jpg"/>
            </div>
            <div class="text-info">
                <span class="J_Price price-now">¥39.00</span>
                <span id="Stock" class="tb-hidden">库存<span class="stock">1000</span>件</span>
            </div>
        </div>

        </form>
    </div>
</div>

</dd>
</dl>
<div class="clear"></div>
<!--活动	-->
<div class="shopPromotion gold" style="visibility: hidden">
    <div class="hot">
        <dt class="tb-metatit">店铺优惠</dt>
        <div class="gold-list">
            <p>购物满2件打8折，满3件7折<span>点击领券<i class="am-icon-sort-down"></i></span></p>
        </div>
    </div>
    <div class="clear"></div>
    <div class="coupon">
        <dt class="tb-metatit">优惠券</dt>
        <div class="gold-list">
            <ul>
                <li>125减5</li>
                <li>198减10</li>
                <li>298减20</li>
            </ul>
        </div>
    </div>
</div>
</div>

<div class="pay">
    <div class="pay-opt">
        <a href="home.html"><span class="am-icon-home am-icon-fw">首页</span></a>
        <a><span class="am-icon-heart am-icon-fw">收藏</span></a>

    </div>
    <li>
        <div class="clearfix tb-btn tb-btn-buy theme-login">
            <a id="direct_buy" title="点此按钮到下一步确认购买信息">
                立即购买
            </a>
        </div>
    </li>
    <li>
        <div class="clearfix tb-btn tb-btn-basket theme-login">
            @if($product['kucun'])
                {{--如果要阻止a标签的默认跳转事件,可以在a标签中去掉href属性,或者设置href的值为href="javascript:;"--}}
                <a id="LikBasket" title="加入购物车" onclick="addCart()" href="javascript:"><i></i>加入购物车</a>
            @else
                <a id="LikBasket" title="暂时缺货" href="#"><i></i>暂时缺货</a>
            @endif
        </div>
    </li>
    <script>
        //用户点击添加购物车方法
        function addCart() {
            let arr = new Array();
            //获取用户当前的购买数量
            arr['num'] = $('#text_box_me').val();
            // 加入购物车只需要一个货品信息就行,商品编号可以从货品信息中获取到
            {{--arr['goods_id'] = {{$goodsInfo['id']}};--}}
            //这里面也有一点儿需要注意跳转到这个页面的时候会传递$product这个参数,
            //$product这个参数有两种情况,当进入页面路由中没有带product参数的时候$product就是当前所展示商品对应第一个货品对象,可能没有为null.但是当商品没有对应货品信息的时候$product['kucun']为假按钮不会展示,就不能进入这个方法所以不用担心$product['id']为空
            //情况二是当进入当前页面路由中带有product参数的时候$product就是所带参数对应的product对象
            arr['product_id'] = {{$product['id']}};
            // 通过js也可以实现页面跳转到购物车页面,并传递参数
            location.href = '/cart/' + arr['product_id'] + '/' + arr['num'];
        }

        //用户直接点击立即购买的方法
        $(function () {
            $("#direct_buy").click(function () {
                //我这里展示商品详情页采用的时候当用户选择点击不同规格product的时候页面会重新加载并将新选择的product对象传递到这个页面中,所以直接使用跟上面一样的方式$product['id'就可以获取到用户选择的货品id,其实通过js也可以获取到用户选择的货品id
                //通过js的方式抓取当用户当前选中的货品id
                let product_id = $("#productInfo").find("li.selected").attr('product_id');
                //抓取当前用户的购买数量
                let num = $('#text_box_me').val();
                //然后将上面的参数传递到直接生成订单的方法中,有要购买的货品id和购买数量就可以生成订单了
                location.href = "{{route('center.direct.order.index')}}" +
                    "?product_id=" + product_id + "&num=" + num;


            })
        })
    </script>
</div>

</div>

<div class="clear"></div>

</div>

<!--优惠套装-->
<div class="match" >
    <div class="match-title">宝贝详情</div>
    <div class="match-comment" style="display: none">
        <ul class="like_list">
            <li>
                <div class="s_picBox">
                    <a class="s_pic" href="#"><img src="{{asset('/org/site')}}/images/cp.jpg"></a>
                </div>
                <a class="txt" target="_blank" href="#">萨拉米 1+1小鸡腿</a>
                <div class="info-box"><span class="info-box-price">¥ 29.90</span> <span class="info-original-price">￥ 199.00</span>
                </div>
            </li>
            <li class="plus_icon"><i>+</i></li>
            <li>
                <div class="s_picBox">
                    <a class="s_pic" href="#"><img src="{{asset('/org/site')}}/images/cp2.jpg"></a>
                </div>
                <a class="txt" target="_blank" href="#">ZEK 原味海苔</a>
                <div class="info-box"><span class="info-box-price">¥ 8.90</span> <span class="info-original-price">￥ 299.00</span>
                </div>
            </li>
            <li class="plus_icon"><i>=</i></li>
            <li class="total_price">
                <p class="combo_price"><span class="c-title">套餐价:</span><span>￥35.00</span></p>
                <p class="save_all">共省:<span>￥463.00</span></p> <a href="#" class="buy_now">立即购买</a></li>
            <li class="plus_icon"><i class="am-icon-angle-right"></i></li>
        </ul>
    </div>
</div>
<div class="clear"></div>


<!-- introduce-->

<div class="introduce">
    <div class="browse">
        <div class="mc">
            <ul>
                <div class="mt">
                    <h2>看了又看</h2>
                </div>

                {{--从商品表中随机选几个商品展示到这里--}}
                @foreach(\App\Models\Goods::where('id','<>',request('goods')['id']*1)->where('id','<',10)->select('id','pics','price','title')->get()->random(3)  as $value)
                    <li>
                        <div class="p-img">
                            <a href="{{route('site.detail',$value['id'])}}">
                                <img class="" src="{{$value['pics'][0]}}">
                            </a>
                        </div>
                        <div class="p-name">
                            <a href="#">
                                {{$value['title']}}
                            </a>
                        </div>
                        <div class="p-price"><strong>￥{{$value['price']}}</strong></div>
                    </li>
                @endforeach
            </ul>
        </div>
    </div>
    <div class="introduceMain">
        <div class="am-tabs" data-am-tabs>
            <ul class="am-avg-sm-3 am-tabs-nav am-nav am-nav-tabs">
                <li class="am-active">
                    <a href="#">

                        <span class="index-needs-dt-txt">宝贝详情</span></a>

                </li>

                <li style="display: none">
                    <a href="#">
                        <span class="index-needs-dt-txt">全部评价</span></a>

                </li>

            </ul>

            <div class="am-tabs-bd">

                <div class="am-tab-panel am-fade am-in am-active">
                    <div class="J_Brand">

                        <div class="attr-list-hd tm-clear">
                            <h4>产品参数：</h4></div>
                        <div class="clear"></div>
                        <ul id="J_AttrUL">
                            <li title="">产品类型:&nbsp;烘炒类</li>
                            <li title="">原料产地:&nbsp;巴基斯坦</li>
                            <li title="">产地:&nbsp;湖北省武汉市</li>
                            <li title="">配料表:&nbsp;进口松子、食用盐</li>
                            <li title="">产品规格:&nbsp;210g</li>
                            <li title="">保质期:&nbsp;180天</li>
                            <li title="">产品标准号:&nbsp;GB/T 22165</li>
                            <li title="">生产许可证编号：&nbsp;QS4201 1801 0226</li>
                            <li title="">储存方法：&nbsp;请放置于常温、阴凉、通风、干燥处保存</li>
                            <li title="">食用方法：&nbsp;开袋去壳即食</li>
                        </ul>
                        <div class="clear"></div>
                    </div>

                    <div class="details">
                        <div class="attr-list-hd after-market-hd">
                            <h4>商品细节</h4>
                        </div>
                        <div class="twlistNews">
                            {!! $goodsInfo['contant'] !!}
                        </div>
                    </div>
                    <div class="clear"></div>

                </div>

                <div class="am-tab-panel am-fade">

                    <div class="actor-new">
                        <div class="rate">
                            <strong>100<span>%</span></strong><br> <span>好评度</span>
                        </div>
                        <dl>
                            <dt>买家印象</dt>
                            <dd class="p-bfc">
                                <q class="comm-tags"><span>味道不错</span><em>(2177)</em></q>
                                <q class="comm-tags"><span>颗粒饱满</span><em>(1860)</em></q>
                            </dd>
                        </dl>
                    </div>
                    <div class="clear"></div>
                    <div class="tb-r-filter-bar">
                        <ul class=" tb-taglist am-avg-sm-4">
                            <li class="tb-taglist-li tb-taglist-li-current">
                                <div class="comment-info">
                                    <span>全部评价</span>
                                    <span class="tb-tbcr-num">(32)</span>
                                </div>
                            </li>

                            <li class="tb-taglist-li tb-taglist-li-1">
                                <div class="comment-info">
                                    <span>好评</span>
                                    <span class="tb-tbcr-num">(32)</span>
                                </div>
                            </li>

                            <li class="tb-taglist-li tb-taglist-li-0">
                                <div class="comment-info">
                                    <span>中评</span>
                                    <span class="tb-tbcr-num">(32)</span>
                                </div>
                            </li>

                            <li class="tb-taglist-li tb-taglist-li--1">
                                <div class="comment-info">
                                    <span>差评</span>
                                    <span class="tb-tbcr-num">(32)</span>
                                </div>
                            </li>
                        </ul>
                    </div>
                    <div class="clear"></div>

                    <ul class="am-comments-list am-comments-list-flip">

                        <li class="am-comment">
                            <!-- 评论容器 -->
                            <a href="">
                                <img class="am-comment-avatar" src="{{asset('/org/site')}}/images/hwbn40x40.jpg"/>
                                <!-- 评论者头像 -->
                            </a>

                            <div class="am-comment-main">
                                <!-- 评论内容容器 -->
                                <header class="am-comment-hd">
                                    <!--<h3 class="am-comment-title">评论标题</h3>-->
                                    <div class="am-comment-meta">
                                        <!-- 评论元数据 -->
                                        <a href="#link-to-user" class="am-comment-author">b***1 (匿名)</a>
                                        <!-- 评论者 -->
                                        评论于
                                        <time datetime="">2015年11月02日 17:46</time>
                                    </div>
                                </header>

                                <div class="am-comment-bd">
                                    <div class="tb-rev-item " data-id="255776406962">
                                        <div class="J_TbcRate_ReviewContent tb-tbcr-content ">
                                            摸起来丝滑柔软，不厚，没色差，颜色好看！买这个衣服还接到诈骗电话，我很好奇他们是怎么知道我买了这件衣服，并且还知道我的电话的！
                                        </div>
                                        <div class="tb-r-act-bar">
                                            颜色分类：柠檬黄&nbsp;&nbsp;尺码：S
                                        </div>
                                    </div>

                                </div>
                                <!-- 评论内容 -->
                            </div>
                        </li>
                        <li class="am-comment">
                            <!-- 评论容器 -->
                            <a href="">
                                <img class="am-comment-avatar" src="{{asset('/org/site')}}/images/hwbn40x40.jpg"/>
                                <!-- 评论者头像 -->
                            </a>

                            <div class="am-comment-main">
                                <!-- 评论内容容器 -->
                                <header class="am-comment-hd">
                                    <!--<h3 class="am-comment-title">评论标题</h3>-->
                                    <div class="am-comment-meta">
                                        <!-- 评论元数据 -->
                                        <a href="#link-to-user" class="am-comment-author">l***4 (匿名)</a>
                                        <!-- 评论者 -->
                                        评论于
                                        <time datetime="">2015年10月28日 11:33</time>
                                    </div>
                                </header>

                                <div class="am-comment-bd">
                                    <div class="tb-rev-item " data-id="255095758792">
                                        <div class="J_TbcRate_ReviewContent tb-tbcr-content ">
                                            没有色差，很暖和……美美的
                                        </div>
                                        <div class="tb-r-act-bar">
                                            颜色分类：蓝调灰&nbsp;&nbsp;尺码：2XL
                                        </div>
                                    </div>

                                </div>
                                <!-- 评论内容 -->
                            </div>
                        </li>
                    </ul>

                    <div class="clear"></div>

                    <!--分页 -->
                    <ul class="am-pagination am-pagination-right">
                        <li class="am-disabled"><a href="#">&laquo;</a></li>
                        <li class="am-active"><a href="#">1</a></li>
                        <li><a href="#">2</a></li>
                        <li><a href="#">3</a></li>
                        <li><a href="#">4</a></li>
                        <li><a href="#">5</a></li>
                        <li><a href="#">&raquo;</a></li>
                    </ul>
                    <div class="clear"></div>

                    <div class="tb-reviewsft">
                        <div class="tb-rate-alert type-attention">购买前请查看该商品的 <a href="#" target="_blank">购物保障</a>，明确您的售后保障权益。
                        </div>
                    </div>

                </div>
            </div>

        </div>

        <div class="clear"></div>
        {{--公共的底部区域--}}
        @include('site.layouts._bottom')
    </div>

</div>
</div>
<!--公共的侧边栏菜单 -->
@include('site.layouts._slidebar')

<script>
    @if(session()->has('success'))
    // session 函数可以用来获取或者设置 Session 值
    swal({
        title: '{{session('success')}}',
        animation: false,
        customClass: 'animated tada'
    })
    @elseif(session()->has('error'))
    swal({
        title: '{{session('error')}}',
        animation: false,
        customClass: 'animated tada'
    })
    @endif
</script>
</body>

</html>
